<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <link rel="stylesheet" type="text/css"
          href="${pageContext.request.contextPath}/assets/H-ui/static/h-ui/css/H-ui.min.css"/>
    <%--引起冲突的样式--%>
    <%--<link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/table.css"/>--%>
    <link rel="stylesheet" type="text/css"
          href="${pageContext.request.contextPath}/assets/H-ui/lib/Hui-iconfont/1.0.8/iconfont.css"/>
    <link rel="stylesheet" type="text/css"
          href="${pageContext.request.contextPath}/assets/H-ui/static/h-ui.admin/skin/default/skin.css" id="skin"/>
    <link rel="stylesheet" type="text/css"
          href="${pageContext.request.contextPath}/assets/H-ui/static/h-ui.admin/css/style.css"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/bootstrap.css"/>
    <!--_footer 作为公共模版分离出去-->
    <script src="${pageContext.request.contextPath}/assets/js/jquery.min.js"></script>
    <script src="${pageContext.request.contextPath}/assets/js/bootstrap.min.js"></script>
    <!--/_footer /作为公共模版分离出去-->
    <title>医生小结</title>
</head>
<body>
                    <table class="table table-border table-bordered table-hover table-bg table-sort">
                        <div align="center"><h3>项目体检详情</h3></div>
                        <thead>
                        <tr class="text-c">
                            <th width="100">报告Id</th>
                            <th width="40">体检项</th>
                            <th width="90">体检小结</th>
                            <th width="100">体检状态</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:if test="${not empty page}">
                            <c:forEach items="${page.list}" var="report">
                                <tr class="text-c">
                                    <td>${report.reportId}</td>
                                    <td>${report.item.itemName}</td>
                                    <td>${report.remark}</td>
                                    <td>${report.state.stateName}</td>

                                </tr>
                            </c:forEach>
                        </c:if>
                        </tbody>
                    </table>
                    <div id="page" style="float: right" align="center">
                        总共${page.pages}页，当前第${page.pageNum}页,每页总共${page.pageSize}。
                        <a id="firstPage" class="btn-sm btn-primary" onclick="changeNum(${page.prePage})">上一页</a>
                        <a id="lastPage" class="btn-sm btn-primary" onclick="changeNum(${page.nextPage})">下一页</a>
                    </div>
                    <br>
        <%--项目总结模块--%>
            <div class="text-c">
                总结评语：
                <select onchange="chooseRemark(this)" id="remarkField">
                <option>请选择总结</option>
                <c:if test="${not empty summarys}">
                    <c:forEach items="${summarys}" var="summary">
                        <option value="${summary.content}">${summary.abbreviation}</option>
                    </c:forEach>
                </c:if>
            </select>
            </div>
            <div class="text-c">
                <br>
                <span style="font-size: 20px;color: red">总结评语:</span>
                <span style="font-size: 20px;color: red" id="field_input"></span>
                <br>
                <textarea style="width: 1000px;height: 50px" id="field"></textarea><br>
            </div>

            <div class="text-c">
                建议：
                <select onchange="chooseRemark1(this)" id="suggestField">
                <option>请选择建议</option>
                <c:if test="${not empty suggests}">
                    <c:forEach items="${suggests}" var="suggest">
                        <option value="${suggest.content}">${suggest.abbreviation}</option>
                    </c:forEach>
                </c:if>
            </select>
            </div>
            <div class="text-c">
                <br>
                <span style="font-size: 20px;color: red">建议:</span>
                <span style="font-size: 20px;color: red" id="suggestField_input"></span>
                <br>
                <textarea style="width: 1000px;height: 50px" id="suggest"></textarea><br>
                <input type="button" value="提交评语" onclick="addRemark()">
                <input type="button" value="返回" onclick="returnRemark()">
            </div>

<script type="text/javascript">
    $(function () {
        if (${page.isLastPage}) {
            $("#lastPage").removeAttr("onclick");
        }
    });

    function changeNum(obj) {
        var num=obj;
        window.location.href="${pageContext.request.contextPath}/report/allRemark.action?reportId=${reportId}&num="+num;
    }

    // 选择评语
    function chooseRemark(obj) {
        var remarkField = $("#remarkField").val();
        var field = $("#field");
        field.text("" + remarkField);
    }
    //选择建议
    function chooseRemark1(obj) {
        var suggestField=$("#suggestField").val();
        var suggest=$("#suggest");
        suggest.text(""+suggestField);
    }
    // 选择评语提交
    function addRemark() {
        var flag = true;
        var field = $("#field").val();
        var field_input = $("#field_input");
        field_input.text("");
        if (field == null || field == "") {
            field_input.text("总结评语不能为空");
            flag = false;
            return;
        }

        var suggest=$("#suggest").val();
        var suggestField_input=$("#suggestField_input");
        suggestField_input.text("");
        if (suggest == null || suggest == "") {
            suggestField_input.text("总结建议不能为空");
            flag = false;
            return;
        }
        if (flag == true){
            location.href = "${pageContext.request.contextPath}/report/addFinally.action?reportId=${reportId}&suggest="+suggest+"&guidance="+field;
        }
    }
    function returnRemark() {
         location.href="${pageContext.request.contextPath}/report/allReport.action";
    }

</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>